Significant Type Specifiers

Whenever a declaration is encountered, each type specifier (if any) in the declaration is converted to one of the following type specifiers, which are collectively called the significant type specifiers.

          |------------   fixnum 
          |------------   character 
          |------------   short-float 
          |------------   long-float 
      t --|----   (array t)  --------------  (vector t) 
          |----   (array fixnum)  ---------  (vector fixnum) 
          |----   (array string-char)   ---  string 
          |----   (array short-float)   ---  (vector short-float) 
          |----   (array long-float)    ---  (vector long-float) 
          |----   (array bit)   -----------   bit-vector

Here, the lines indicate subtype relations; the right type is a subtype of the left type. For instance, (vector t) is a subtype of (array t) and t, and (array t) itself is a subtype of t. However, (array t) and (array string-char) are disjoint types.


The function subtypep is used for the conversion to significant type specifiers: If the first value of (subtypep raw-type type) is t for one of the significant type specifiers type, then the type specifier raw-type in the declaration is converted to type. If there are more than one such significant type specifiers, then the type specifier that is a subtype of other specifiers is selected. For example, type specifiers fixnum, (mod 3), and (member 0 1) are all converted to fixnum, though they are also subtypes of t.


Because of this type specifier conversion, KCL may sometimes regard two seemingly distinct declarations as the same. For example, the following type declarations are completely equivalent, internally in KCL.

    (declare (type fixnum x))

    (declare (type (mod 3) x))

    (declare (type (member 0 1) x))

Type specifiers in declaration specifications passed to the KCL specific function proclamation are also converted to significant type specifiers. Thus, for example,

    >(proclaim '(function foo (fixnum) fixnum))
    nil
 
    >(proclamation '(function foo ((mod 3)) (member 0 1)))
    t
 
    >(proclamation '(function foo (number) character))
    nil

The first call to proclamation returns t because both (mod 3) and (member 0 1) are converted to fixnum before the function type of foo is checked.